package com.raulraja.view.object;

import com.raulraja.model.domain.readonly.PersonReadOnly;

/**
 * A Person View Object containing the info to render the ui
 * notice that in this example the password is not exposed in this layer purposedly to show
 * how VOs can help you secure wich data goes where
 */
public class PersonVO extends ExceptionSupportVO {

	/**
	 * the unique identifier
	 */
	private Long id;

	/**
	 * the email
	 */
	private String email;

	/**
	 * default constructor
	 */
	public PersonVO() {
		super();
	}

	/**
	 * Constructor based on data comming from the business service layers, taking the data as a read only facade
	 * This pattern ensure that the view layer does not modify state directly without actually going through business rules
	 * @param personReadOnly a read only facade of Person exposing property getters only
	 */
	public PersonVO(PersonReadOnly personReadOnly) {
		this();
		setId(personReadOnly.getId());
		setEmail(personReadOnly.getEmail());
	}

	/**
	 * Cosntructor supporting exceptions
	 * @param e the exception
	 */
	public PersonVO(Throwable e) {
		super(e);
	}

	/**
	 * @return the unique identifier
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the unique identifier
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email the email
	 */
	public void setEmail(String email) {
		this.email = email;
	}
}
